<template>
  <div class="contents">
    <van-card
      v-for="(cont, i) in comments"
      :key="i"
      :desc="cont.content"
      :title="cont.goodsname"
      :thumb="cont.img"
      class="rr"
    >
      <template #tags>
        <van-rate
          :value="cont.rate"
          :size="25"
          color="#ffd21e"
          void-icon="star"
          void-color="#eee"
          readonly
        />
      </template>
      <template #footer>
        <van-button size="small">修改评价</van-button>
        <van-button size="small" @click="seecon(cont.id)">查看评价</van-button>
      </template>
    </van-card>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "contents",
  data() {
    return {
      value: 5,
      comments: [],
    };
  },
  methods: {
    seecon(ids) {
      this.$router.push({ path: "/contenttext", query: {ids} });
    },
  },
  created() {
    axios({
      method: "get",
      url: "/comments",
    }).then((res) => {
      this.comments = res.data;
    });
  },
};
</script>
<style  scoped>
.rr {
  border-radius: 0.1rem;
  background-color: #fff;
  margin: 0.1rem 0.1rem;
}
</style>
<style>
.van-card__title {
  font-size: 0.18rem;
  height: 0.24rem;
}
</style>

